<include file="public@header" />
</head>
<body>
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>

	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('user/index')}">员工管理</a></li>
			<li class="active"><a href="{:url('user/add')}">员工添加</a></li>
		</ul>
	<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('user/addpost')}">

		 <div class="row">
		 <div class="col-md-9">
          <table class="table table-bordered">
                  <tr>
                      <th style="width: 170px"><span class="form-required">*</span>{:lang('USERNAME')}</th>
                      <td>
                         <input type="text" class="form-control" id="input-user_login" name="post[user_login]" required="required">
                      </td>
                  </tr>
                  <tr>
                      <th style="width: 170px">手机号码</th>
                      <td>
                         <input type="text" class="form-control"  name="post[mobile]">
                      </td>
                  </tr>
                  <tr>
                      <th style="width: 170px">{:lang('PASSWORD')}</th>
                      <td>
                        <input type="password" class="form-control" id="input-user_pass" name="post[user_pass]" placeholder="******">
                      </td>
                  </tr>
                  <tr>
                      <th style="width: 170px">重复密码</th>
                      <td>
                       <input type="password" class="form-control" id="input-user_pass" name="post[d_pass]">
                      </td>
                  </tr>
                  <tr>
                      <th style="width: 170px">{:lang('EMAIL')}</th>
                      <td>
                      <input type="text" class="form-control" id="input-user_email" name="post[user_email]">
                      </td>
                  </tr>
                  <tr>
                      <th>角色</th>
                      <td>
                          <select class="form-control" name='role_id'>{$roleList}</select>
                          <input type="hidden" name="company_id" value="{$company['id']}">
                      </td>
                  </tr>
          </table>
          <!--角色弹窗-->
          <div id="roleselect_tc" style="display: none;">
              <div id="roleselect_list" style="margin: 5px;"></div>
          </div>

          <div class="form-group">
              <div class="col-sm-offset-2 col-sm-10">
              	<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
              </div>
          </div>
			
			</div>
				
      <div class="col-md-3">
          <table class="table table-bordered">
              <tr>
                  <th><b>头像上传</b></th>
              </tr>
              <tr>
                  <td>
                      <div style="text-align: center;">
                          <input type="hidden" name="post[avatar]" id="thumbnail" value="">
                          <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                              <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                   id="thumbnail-preview"
                                   width="130" height="130"  style="cursor: pointer;border-radius: 50%"/>
                          </a>
                          <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                      </div>
                  </td>
              </tr>
          </table>
      </div>
	</div>
	</form>
	</div>
	<script type="text/javascript">
    $(function () {
        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {

        }
        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });
		</script>
	<script src="__STATIC__/js/admin.js"></script>
	<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script src="__STATIC__/js/zy-treeview/zy-treeview.1.0.js"></script>


<script  type="text/javascript">

$(function(){
  var SELECT_ID=null,SELECT_NAME=null;
  var list={$roleList};
  var highest=null;
    //选择角色弹窗·
  //获取角色id
  var role_id=$('input[id=role_id]').val();
  $('#role_select').on('click',function(){ 
  $("#roleselect_list").treeView({data:list,radio:true});
      //加载角色数据
      //弹出选择框
      var index=layer.open({
          type: 1,
          title: '修改角色',
          area: ['700px', '600px'],
          closeBtn: 1,
          btn:['确定','取消'],
          shadeClose: true,
          skin: 'yourclass',
          scrollbar: false,
          content: $("#roleselect_tc "),
          yes:function(){
            //获取选中数据
            $('input[id=role_id]').val(SELECT_ID);
            $('input[name=role_name]').val(SELECT_NAME);
            layer.close(index);
          }
      });
  });

//列表点击事件
    $("#roleselect_list").on('click','li',function(){
        $(this).css('backgroundColor','#ccc');
        var  name=$(this).find('.li_text').text();
        var id=$(this).data('tag');
        console.log(id);
        $(this).find('.tree_radio').prop('checked',true);
        SELECT_ID=id;
        SELECT_NAME=name;
/*        $('input[id=role_id]').val(id);
        $('input[name=role_name]').val(name);*/
      });
});
</script>



</body>
</html>